package domain;

public class Edge {

	int label;
	Vertex src;
	Vertex dest;

	public Edge(int label, Vertex src, Vertex dest) {
		super();
		this.label = label;
		this.src = src;
		this.dest = dest;
	}
	
	//if the given vertices appears in this edge (oly with different ops)
	public boolean identicalVertices(Vertex src, Vertex dest){
		return this.src.equals(src) && this.dest.equals(dest);
	}
	
	public boolean isEqEdge(){
		return this.label==FeatureGraph.INTEQ;
	}

	public boolean isLTEdge(){
		return this.label == FeatureGraph.INTLT;
	}
	
	public boolean isLTEQEdge(){
		return this.label == FeatureGraph.INTLTEQ;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((dest == null) ? 0 : dest.hashCode());
		result = prime * result + label;
		result = prime * result + ((src == null) ? 0 : src.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Edge other = (Edge) obj;
		if (dest == null) {
			if (other.dest != null)
				return false;
		} else if (!dest.equals(other.dest))
			return false;
		if (label != other.label)
			return false;
		if (src == null) {
			if (other.src != null)
				return false;
		} else if (!src.equals(other.src))
			return false;
		return true;
	}

	@Override 
	public String toString(){
		return this.src.toString() + " " +this.label +" " +this.dest.toString();
	}
	
	
}
